# -*- coding: utf-8 -*-
"""
------------------------------------------------------------------------------
    File Name:  constants
    Author   :  wanwei1029
    Date     :  2018/10/11
    Desc     :
------------------------------------------------------------------------------
"""
import redis

SAVE_DIR = r'E:\nas\spider\aikantxt\8001-10000'

REDIS_HOST = "192.168.99.100"
REDIS_PORT = "6379"
REDIS_DB = 0

FLAG_SUCCESS = "SUCCESS"
FLAG_ERROR = "ERROR"

redis_client = None


class RedisClient(object):

    @staticmethod
    def get_client():
        if not redis_client:
            pool = redis.ConnectionPool(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB, decode_responses=True)
            client = redis.StrictRedis(connection_pool=pool)
        return client


def rem_special_char(msg):
    msg = msg.replace(" ", "")
    msg = msg.replace("/", "")
    msg = msg.replace("\\", "")
    msg = msg.replace(":", "：")
    msg = msg.replace("<", "《")
    msg = msg.replace(">", "》")
    msg = msg.replace("?", "？")
    msg = msg.replace("*", "")
    msg = msg.replace("!", "！")
    msg = msg.replace("|", "_")
    msg = msg.replace('"', "“")
    return msg

def demo():
    """
    """


if __name__ == '__main__':
    test_method = "demo"
    if test_method == "demo":
        demo()
